import Cookies from 'js-cookie'
const userInfo = {
  state: {
     user:{},
     works:{},
     permission:[],
  },
  mutations: {
    SET_USER_INFO(state,user){
      state.user=user;
    },
    SET_WORK_INFO(state,works){
      state.works=works;
    },
    SET_PERMISSION(state,permission){
      state.permission=permission;
    }
  },
  actions:{
    setLoginUserDetail({commit},user) {
      return new Promise(resolve => {
        commit('SET_USER_INFO',user);
        resolve()
      })
    },
    setWorkDetail({commit},works) {
      return new Promise(resolve => {
        commit('SET_WORK_INFO',works);
        resolve()
      })
    },
    LogOut({commit},user) {
      return new Promise(resolve => {
        commit('SET_USER_INFO',{});
        resolve()
      })
    },
  }
};
export default userInfo
